package com.dure.hotmemory.scenes;

import android.Manifest;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.EmbossMaskFilter;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RadialGradient;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.os.Environment;
import android.text.TextUtils;

import com.dure.commonlib.util.AssetsUtil;
import com.dure.commonlib.util.DimentionUtil;
import com.dure.commonlib.util.PathUtil;
import com.dure.hotmemory.R;
import com.dure.hotmemory.bean.Bean;
import com.dure.hotmemory.bean.Planet;
import com.dure.hotmemory.controllers.MainController;
import com.dure.hotmemory.drawview.BaseSurfaceView;
import com.dure.hotmemory.utils.GDTADUtil;
import com.socks.library.KLog;

/**
 * Created by zhanglong on 2016/11/1 17:23.
 */
public class MainScene extends BaseScene {
    private Paint paint, circlePaint;
    private Bitmap homeImg, homePressedImg, statisticsImg;
    private Rect homeSrcRect;
    private RectF homeDstRect;
    private int connectionChangeStep = 20;
    private boolean connectionDataPrepared;
    float ballRadiusChangedValue;
    float ballRadiusChangeStep;
    float textSizeChangedValue;
    private float connerOrbitRadius;
    private float connerPlanetRadius = 400;
    private int ballRadius;
    int currentAlpha, changedAlpha;
    private float textSize;


    private Planet currentPlanet;
    private Paint textPaint;
    private int lineSize = 5;
    private boolean showConnection = true;
    private boolean mainDataPrepared;

    float connerOrbitPlanetRadiusMutiple = 2.5f;
    float centerOrbitPlanetRadiusMutiple = 1.75f;

    private float offsetX, offsetY;
    private boolean showConnerToCenter, showCenterToConner, changeCurrentPlanet;
    private float textSizeChangeStep;

    float degreeIncreaseStep = 0.05f;
    private int moveStep = 10;
    private float perScaleOff;

    double degreeStep;
    double totalDegree;
    private int selectedPlanetIndex;
    private boolean showHome = true;
    private int homeRightPadding = 50;
    private int homeTopPadding = 50;
    private float homeCircleCenterX, homeCircleCenterY, homeRadius;
    private boolean homePressed, planetClicked;
    private Planet clickedPlanet;
    private float homeWidth, homeTop;
    private boolean dataLoaded;
    //    private Rect statisticSrcRect;
//    private RectF statisticDstRect = new RectF();
    private MainController mainController;
    public float topCircleRadius;
    float[] colorRatio = {0.5f, 1f};
    int shadowColor = Color.parseColor("#4C4C4C");
    int[] pressedColors = {Color.parseColor("#989898"), shadowColor};


    public MainScene(BaseSurfaceView baseSurfaceView) {
        super(baseSurfaceView);
        left = baseSurfaceView.getWidth();
        mainController = new MainController(this);
        mainController.checkUpdate();
        initData();

        activity.showAd();
        activity.showInterstitialAd();

    }

    @Override
    public void onRestart() {
        activity.showAd();
    }

    @Override
    public void initData() {

        paint = new Paint();
        paint.setColor(Color.WHITE);
        paint.setAntiAlias(true);
        paint.setStrokeWidth(lineSize);
        paint.setStyle(Paint.Style.FILL);

        circlePaint = new Paint();
        circlePaint.setColor(Color.WHITE);
        circlePaint.setAntiAlias(true);

        textPaint = new Paint();
        textPaint.setColor(Color.BLACK);
        textPaint.setAntiAlias(true);
        textPaint.setTextSize(textSize);
        // 添加字体阴影
        textPaint.setShadowLayer(2,3, 3, shadowColor);

        // 让字体具有立体感, 不过不能和阴影同时存在
//        float[] direction = new float[] { 1, 1, 1 };
//        // 设置环境光亮度
//        float light = 0.1f;
//        // 选择要应用的反射等级
//        float specular = 8;
//        // 向mask应用一定级别的模糊
//        float blur = 3;
//        emboss = new EmbossMaskFilter(direction, light, specular, blur);
//        textPaint.setMaskFilter(emboss);

        homeDstRect = new RectF();

        initDataFinished = true;

    }


    @Override
    public void handleRequestSuccess(Bean bean) {
        mainController.handleRequestSuccess(bean);
    }


    @Override
    public void handleData() {
        if (!dataLoaded) {// 加载资源
            dataLoaded = true;
            homeImg = BitmapFactory.decodeStream(AssetsUtil.getAssets(baseSurfaceView.getContext(), "home_white.png"));
            homePressedImg = BitmapFactory.decodeStream(AssetsUtil.getAssets(baseSurfaceView.getContext(), "home.png"));
            currentPlanet = mainController.getAllPlanets();
        }

        if (!initDataFinished)
            return;

        if (currentPlanet != null) {
            if (showConnection) {
                handleConnectionData();
            } else {
                handleMainData();
            }
        }
    }

    private void handleConnectionData() {
        if (!connectionDataPrepared) {// 先准备绘制过渡界面的数据
            // 对星球相关的数据进行初始化
            Path path = new Path();
            path.moveTo(0, 0);
            path.lineTo(baseSurfaceView.getWidth() / 2, baseSurfaceView.getHeight() / 2);
            connerOrbitRadius = PathUtil.getPathLength(path);
            connerPlanetRadius = connerOrbitRadius / connerOrbitPlanetRadiusMutiple;

            ballRadius = baseSurfaceView.getWidth() / 40;
            // 初始化过渡界面星球和字体，透明度等数据
            ballRadiusChangeStep = (connerPlanetRadius / 2 - ballRadius) / connectionChangeStep;
            changedAlpha = 255 / connectionChangeStep;
            textSize = baseSurfaceView.getWidth() / 15f;
            textSizeChangedValue = textSize * 1.0f / connectionChangeStep;

            currentPlanet.radius = ballRadius;
            currentPlanet.xPosition = baseSurfaceView.getWidth() / 2;
            currentPlanet.yPosition = baseSurfaceView.getHeight() / 2;
            currentPlanet.textSize = 0;

            connectionDataPrepared = true;
        } else {
            if (currentAlpha < 255) {
                currentPlanet.radius += ballRadiusChangeStep;
                currentAlpha += changedAlpha;
                currentPlanet.textSize += textSizeChangedValue;

            } else {// 过渡界面结束
                currentAlpha = 255;
                currentPlanet.radius = connerPlanetRadius / 2;
                currentPlanet.textSize = textSize;

                showConnection = false;

                ballRadiusChangedValue = 0;

            }
        }


    }

    private void handleMainData() {
        if (currentPlanet == null)
            return;

        if (!mainDataPrepared) {
            moveSpeed = 0;
            topCircleRadius = DimentionUtil.dpToPx(baseSurfaceView.context, 40) / 2;
            homeWidth = DimentionUtil.dpToPx(baseSurfaceView.context, 30);
            homeRightPadding = DimentionUtil.dpToPx(baseSurfaceView.context, 10);
            homeTopPadding = DimentionUtil.dpToPx(baseSurfaceView.context, 10);

            homeCircleCenterX = baseSurfaceView.getWidth() - homeRightPadding - topCircleRadius;
            homeCircleCenterY = homeTopPadding + topCircleRadius;
            homeRadius = topCircleRadius;
            homeTop = homeCircleCenterY - homeWidth / 2;

            homeSrcRect = new Rect(0, 0, homeImg.getWidth(), homeImg.getHeight());
//            statisticSrcRect = new Rect(0, 0, statisticsImg.getWidth(), statisticsImg.getHeight());

            // 对星球相关的数据进行初始化
            Path path = new Path();
            path.moveTo(0, 0);
            path.lineTo(baseSurfaceView.getWidth() / 2, baseSurfaceView.getHeight() / 2);
            connerOrbitRadius = PathUtil.getPathLength(path);
            connerPlanetRadius = connerOrbitRadius / connerOrbitPlanetRadiusMutiple;


            currentPlanet.radius = connerPlanetRadius / 2;
            currentPlanet.xPosition = baseSurfaceView.getWidth() / 2;
            currentPlanet.yPosition = baseSurfaceView.getHeight() / 2;
            currentPlanet.textSize = baseSurfaceView.getWidth() / 15f;

            mainDataPrepared = true;
        }

        handleHomeData();
        changePlanet();
        handleCenterPlanetData();
    }

    private void handleHomeData() {

        homeCircleCenterX += moveSpeed;

        float homeLeft = homeCircleCenterX - homeWidth / 2;

        homeDstRect.left = homeLeft;
        homeDstRect.top = homeTop;
        homeDstRect.right = homeLeft + homeWidth;
        homeDstRect.bottom = homeTop + homeWidth;

    }

    private void handleCenterPlanetData() {

        currentPlanet.xPosition += moveSpeed;
        if (currentPlanet.parent_planet != null)
            currentPlanet.parent_planet.xPosition += moveSpeed;


        if (currentPlanet.xPosition > baseSurfaceView.getWidth() / 2) {
            currentPlanet.xPosition = baseSurfaceView.getWidth() / 2;
        }

        if (!currentPlanet.childPositioned) {
            currentPlanet.childPositioned = true;
            getPlanetPositions();
        }


        handleChildPlanetData();
    }

    private void getPlanetPositions() {
        int planetNumber = currentPlanet.child_planets.size();
        if (planetNumber <= 0) {
            return;
        }

        double degree = 360 / planetNumber;
        for (int i = 0; i < planetNumber; i++) {
            Planet planet = currentPlanet.child_planets.get(i);
            planet.degree = degree * i;
            planet.radius = currentPlanet.radius / 2;
            planet.textSize = currentPlanet.textSize / 2;
            planet.parent_planet = currentPlanet;
        }
    }

    private void handleChildPlanetData() {

        for (int i = 0; i < currentPlanet.child_planets.size(); i++) {
            Planet planet = currentPlanet.child_planets.get(i);
            double arc = planet.degree * 2 * Math.PI / 360;

            float xPosition = (float) ((centerOrbitPlanetRadiusMutiple * currentPlanet.radius) * Math.cos(arc) + currentPlanet.xPosition);
            float yPosition = (float) ((centerOrbitPlanetRadiusMutiple * currentPlanet.radius) * Math.sin(arc) + currentPlanet.yPosition);
            planet.xPosition = xPosition;
            planet.yPosition = yPosition;

            // 让星球转运起来
            moveChildPlanet(planet);


            planet.parent_planet = currentPlanet;

        }
    }

    private void moveChildPlanet(Planet planet) {
        if (degreeStep == 0)
            planet.degree += degreeIncreaseStep;
        else {
            planet.degree += degreeStep;
        }
        if (planet.degree > 360) {
            planet.degree = planet.degree - 360;
        }
    }

    // 切换成选中的planet
    private void changePlanet() {

        if (offsetX == 0) {
            offsetX = baseSurfaceView.getWidth() / 2f / moveStep;
            offsetY = baseSurfaceView.getHeight() / 2f / moveStep;
            textSizeChangeStep = (textSize * 1.5f - textSize * 1f) / moveStep;

            perScaleOff = (connerPlanetRadius / 2) / moveStep;

        }

        if (showCenterToConner) {

            if (degreeStep == 0) {
                double currentDegree = currentPlanet.child_planets.get(selectedPlanetIndex).degree;

                double finalDegree = Math.toDegrees(Math.atan(baseSurfaceView.getHeight() / baseSurfaceView.getWidth()));

                totalDegree = finalDegree - currentDegree;
                if (finalDegree < currentDegree) {
                    totalDegree = 360 - currentDegree + finalDegree;
                }

                degreeStep = totalDegree / moveStep;

            }

            if (currentPlanet.xPosition > 0) {
                // 让中间planet往左上角移动
                currentPlanet.xPosition -= offsetX;
                currentPlanet.yPosition -= offsetY;

                // 让中间planet字体由小变大
                currentPlanet.textSize += textSizeChangeStep;

                // 让中间planet半径由小变大
                currentPlanet.radius += perScaleOff;

            } else {
                currentPlanet.xPosition = 0;
                showCenterToConner = false;
                degreeStep = 0;

                currentPlanet = currentPlanet.child_planets.get(selectedPlanetIndex);

                currentPlanet.xPosition = baseSurfaceView.getWidth() / 2;
                currentPlanet.yPosition = baseSurfaceView.getHeight() / 2;
                currentPlanet.textSize = baseSurfaceView.getWidth() / 15f;
                currentPlanet.radius = connerPlanetRadius / 2;
            }


        }

        if (showConnerToCenter) {
            if (changeCurrentPlanet) {
                changeCurrentPlanet = false;
                currentPlanet = currentPlanet.parent_planet;
            }
            if (currentPlanet != null){
                if (currentPlanet.xPosition < baseSurfaceView.getWidth() / 2) {
                    // 让conner planet往center移动
                    currentPlanet.xPosition += offsetX;
                    currentPlanet.yPosition += offsetY;

                    // 让conner planet字体由大变小
                    currentPlanet.textSize -= textSizeChangeStep;

                    // 让conner planet半径由大变小
                    currentPlanet.radius -= perScaleOff;
                } else {

                    currentPlanet.xPosition = baseSurfaceView.getWidth() / 2;
                    currentPlanet.yPosition = baseSurfaceView.getHeight() / 2;
                    currentPlanet.radius = connerPlanetRadius / 2;
                    currentPlanet.textSize = baseSurfaceView.getWidth() / 15;
                    showConnerToCenter = false;
                }
            }





        }


    }

    @Override
    public void handleDraw(Canvas canvas) {
        if (!initDataFinished || !dataLoaded)
            return;


        if (showConnection) {
            handleConnectionDraw(canvas);
        } else {
            handleMainDraw(canvas);
        }
    }

    private void handleConnectionDraw(Canvas canvas) {
        if (!connectionDataPrepared) {
            return;
        }


//        // 绘制背景图,由不可见到可见
//        bgPaint.setAlpha(currentAlpha);
        // 绘制中间文字,逐渐扩大
        textPaint.setTextSize(currentPlanet.textSize);
        textPaint.setColor(Color.parseColor(currentPlanet.text_color));

//        float centerX = currentPlanet.xPosition + left;
//        float centerY = currentPlanet.yPosition + top;
        // 绘制中间planet
//        canvas.drawCircle(centerX, centerY, currentPlanet.radius, paint);
        drawPlanet(canvas, currentPlanet, textPaint, paint);

//        float textLeft = currentPlanet.xPosition - textPaint.measureText(currentPlanet.planet) / 2 + left;
//        float textBottom = currentPlanet.yPosition + currentPlanet.textSize / 2 + top;
//        canvas.drawText(currentPlanet.planet, textLeft, textBottom, textPaint);


    }

    private void handleMainDraw(Canvas canvas) {
        if (!mainDataPrepared) {
            return;
        }

        if (currentPlanet == null)
            return;

        if (currentPlanet != null) {
            if (currentPlanet.parent_planet != null && !TextUtils.isEmpty(currentPlanet.planet))
                drawConnerPlanet(canvas);

            drawCenterPlanet(canvas);
        }

        if (showHome) {

            paint.setStrokeWidth(lineSize);
            paint.setStyle(Paint.Style.FILL);
            RectF dstRect = new RectF(homeDstRect.left + left, homeDstRect.top, homeDstRect.right + left, homeDstRect.bottom);

            float shadowStartX = homeCircleCenterX + (float) (homeRadius * 0.6 * Math.cos(Math.toRadians(135)));
            float shadowStartY = homeCircleCenterY - (float) (homeRadius * 0.6 * Math.sin(Math.toRadians(135)));

            if (homePressed) {
                if (homeRadius > 0){
                    RadialGradient radialGradient = new RadialGradient(shadowStartX + left, shadowStartY, 2 * homeRadius,
                            pressedColors, colorRatio, Shader.TileMode.CLAMP);
                    paint.setShader(radialGradient);
                }

                canvas.drawCircle(homeCircleCenterX + left, homeCircleCenterY, homeRadius, paint);
                canvas.drawBitmap(homePressedImg, homeSrcRect, dstRect, null);
            } else {
                if (homeRadius > 0){
                    RadialGradient radialGradient = new RadialGradient(shadowStartX + left, shadowStartY, 2 * homeRadius,
                            new int[]{Color.parseColor("#00BDFF"), shadowColor}, colorRatio, Shader.TileMode.CLAMP);
                    paint.setShader(radialGradient);
                }

                canvas.drawCircle(homeCircleCenterX + left, homeCircleCenterY, homeRadius, paint);
                canvas.drawBitmap(homeImg, homeSrcRect, dstRect, null);
            }


        }
    }

    private void drawConnerPlanet(Canvas canvas) {

        textPaint.setTextSize(currentPlanet.parent_planet.textSize);
        textPaint.setColor(Color.parseColor(currentPlanet.parent_planet.text_color));
        if (currentPlanet.parent_planet.pressed) {
            paint.setColor(Color.parseColor(currentPlanet.parent_planet.pressed_color));
        } else {
            paint.setColor(Color.parseColor(currentPlanet.parent_planet.planet_color));
        }

        drawPlanet(canvas, currentPlanet.parent_planet, textPaint, paint);
        paint.setColor(Color.GRAY);
        paint.setStyle(Paint.Style.STROKE);
        canvas.drawCircle(currentPlanet.parent_planet.xPosition + left, currentPlanet.parent_planet.yPosition,
                currentPlanet.parent_planet.radius * connerOrbitPlanetRadiusMutiple, paint);
        paint.setColor(Color.WHITE);
        paint.setStyle(Paint.Style.FILL);

    }

    private void drawCenterPlanet(final Canvas canvas) {
        textPaint.setTextSize(currentPlanet.textSize);
        textPaint.setColor(Color.parseColor(currentPlanet.text_color));

        // 绘制中间的planet
        if (currentPlanet.pressed) {
            paint.setColor(Color.parseColor(currentPlanet.pressed_color));
        } else {
            paint.setColor(Color.parseColor(currentPlanet.planet_color));
        }
        drawPlanet(canvas, currentPlanet, textPaint, paint);

        circlePaint.setStyle(Paint.Style.STROKE);
        circlePaint.setColor(Color.BLUE);
        circlePaint.setStrokeWidth(5);
        circlePaint.setMaskFilter(new BlurMaskFilter(10, BlurMaskFilter.Blur.OUTER));
        canvas.drawCircle(currentPlanet.xPosition + left, currentPlanet.yPosition,
                currentPlanet.radius * centerOrbitPlanetRadiusMutiple, circlePaint);
//        circlePaint.setMaskFilter(null);
//        circlePaint.setStyle(Paint.Style.FILL);

        if (currentPlanet.child_planets != null && currentPlanet.child_planets.size() > 0)
            drawChildPlanets(canvas);
    }

    private void drawPlanet(Canvas canvas,
                            Planet planet, Paint textPaint, Paint paint) {

        if (planet == currentPlanet || planet == currentPlanet.parent_planet){// 发光效果
//            paint.setMaskFilter(new BlurMaskFilter(planet.radius * 0.1f, BlurMaskFilter.Blur.SOLID));
        }

        float shadowStartX = planet.xPosition + (float) (planet.radius * 0.3 * Math.cos(Math.toRadians(135)));
        float shadowStartY = planet.yPosition - (float) (planet.radius * 0.3 * Math.sin(Math.toRadians(135)));

        int showColor = Color.parseColor(planet.planet_color);
        if (planet.pressed){
            showColor = Color.parseColor(planet.pressed_color);
        }
        if (planet.radius > 0){
            RadialGradient lg = new RadialGradient(shadowStartX + left, shadowStartY, 1.8f * planet.radius,
                    new int[]{showColor,shadowColor}, colorRatio, Shader.TileMode.CLAMP);
            paint.setShader(lg);
        }
        canvas.drawCircle(planet.xPosition + left, planet.yPosition, planet.radius, paint);

        canvas.drawText(planet.planet, planet.xPosition - textPaint.measureText(planet.planet) / 2 + left,
                planet.yPosition + textPaint.getTextSize() / 2, textPaint);

        paint.setMaskFilter(null);

    }

    private void drawChildPlanets(Canvas canvas) {
        for (int i = 0; i < currentPlanet.child_planets.size(); i++) {
            Planet planet = currentPlanet.child_planets.get(i);
            planet.textSize = currentPlanet.textSize / 2;
            planet.radius = currentPlanet.radius / 2;

            textPaint.setTextSize(planet.textSize);
            textPaint.setColor(Color.parseColor(planet.text_color));
            if (planet.pressed) {
                paint.setColor(Color.parseColor(planet.pressed_color));
            } else {
                paint.setColor(Color.parseColor(planet.planet_color));
            }

            drawPlanet(canvas, planet, textPaint, paint);

        }
    }

    @Override
    public void handleBack() {
        homePressed = false;
        backToLastPlanet();
    }

    @Override
    public void handleDown(PointF pointF) {
        if (pointF != null)
            containPoint(pointF.x, pointF.y);
    }

    @Override
    public void handleUp(PointF pointF) {
        if (homePressed) {
            homePressed = false;
            mainController.handler.sendEmptyMessage(0);

        } else if (clickedPlanet != null) {
            clickedPlanet.pressed = false;
            if (clickedPlanet == currentPlanet) {// 点击了中心planet
                if (clickedPlanet.statistics) {
                    mainController.handler.sendEmptyMessage(1);
                    clickedPlanet = null;
                }
            } else if (clickedPlanet.clickedParent) {// 点击了conner planet
                clickedPlanet.clickedParent = false;
                clickedPlanet = null;
                backToLastPlanet();
            } else {// 点击了child planet
                if (clickedPlanet.child_planets == null ||
                        clickedPlanet.child_planets.size() == 0) {// 如果没有子planet说明是要点击跳转了
                    clickedPlanet.parent_planet = currentPlanet;
                    mainController.handler.sendEmptyMessage(2);
                } else {// 点击了child planet,有child开始由中心向左上角移动
                    showConnerToCenter = false;
                    showCenterToConner = true;
                    selectedPlanetIndex = clickedPlanet.positionInParent;
                    showHome = false;
                    clickedPlanet = null;
                }
            }
        }


    }

    private void containPoint(float x, float y) {

        if (showHome) {
            RectF rectF = new RectF();
            Path path = new Path();
            path.addCircle(homeCircleCenterX, homeCircleCenterY, homeRadius, Path.Direction.CCW);
            path.computeBounds(rectF, true);
            if (rectF.contains(x, y)) {// 判断是否点击home图标
                KLog.d("lesleixz", "main home pressed");
                homePressed = true;
                return;
            } else {
                homePressed = false;
            }
        }

        if (currentPlanet == null){
            return;
        }
        if (currentPlanet.parent_planet != null) {// 父planet存在, 先判断是否被点击
            RectF rectF = new RectF();
            Path path = new Path();
            path.addCircle(0, 0, currentPlanet.parent_planet.radius, Path.Direction.CCW);
            path.computeBounds(rectF, true);

            if (rectF.contains(x, y)) {// 点击了父planet
                clickedPlanet = currentPlanet.parent_planet;
                clickedPlanet.pressed = true;
                clickedPlanet.clickedParent = true;
//                backToLastPlanet();// 把操作换在up里面实现， 以实现点击效果
                return;
            }
        }

        // 再判断是否有点击中心planet
        RectF rectF = new RectF();
        Path path = new Path();
        path.addCircle(currentPlanet.xPosition, currentPlanet.yPosition, currentPlanet.radius, Path.Direction.CCW);
        path.computeBounds(rectF, true);

        if (rectF.contains(x, y)) {// 点击了中心planet
            clickedPlanet = currentPlanet;
            clickedPlanet.pressed = true;
            clickedPlanet.clickedParent = false;
            return;
        }

        for (int i = 0; i < currentPlanet.child_planets.size(); i++) {
            final Planet planet = currentPlanet.child_planets.get(i);

            rectF = new RectF();
            path = new Path();

            path.addCircle(planet.xPosition, planet.yPosition, planet.radius, Path.Direction.CCW);
            path.computeBounds(rectF, true);

            if (rectF.contains(x, y)) {
                planet.pressed = true;
                clickedPlanet = planet;
                clickedPlanet.clickedParent = false;
                clickedPlanet.positionInParent = i;
                break;
            }
        }

    }


    public void setCurrentPlanet(Planet planet) {
        currentPlanet = planet;
    }

    public void backToLastPlanet() {
        showConnerToCenter = true;
        showCenterToConner = false;
        changeCurrentPlanet = true;
        if (currentPlanet == null)
            return;

        if (currentPlanet.parent_planet != null && currentPlanet.parent_planet.parent_planet != null) {
            showHome = false;
        } else {
            showHome = true;
//            activity.hideAd();
        }

    }

    public Planet getCurrentPlanet() {
        return currentPlanet;
    }

    public Planet getClickedPlanet() {
        return clickedPlanet;
    }

    public void setClickedPlanet(Planet clickedPlanet) {
        this.clickedPlanet = clickedPlanet;
    }

    public boolean isShowHome() {
        return showHome;
    }


}
